|
|
|
|
|
|
|
Let's also add trace coding to the Command1_click event. Update your form's command1_Click event to match the one in Listing 14.38. |
|
|
|
|
|
|
|
|
Listing 14.38. Updating the Command1_click event to use module tracing. |
|
|
|
|
|
|
|
|
Private Sub Command1_Click()
'
On Error GoTo Localerr
Dim varList As Variant
Dim rtn As Long
'
objTrace.Push "Command1_Click"
'
Print 6 / 0
'
Exit Sub
'
Localerr:
'
rtn = objErr.errHandler(Err, erritem, errresume,
"prjTest.Form1.Command1_Click")
'
objTrace.Show
objTrace.Pop
Resume Next
'
End Sub |
|
|
|
|
|
|
|
|
Save this code and run the project. When you press the command button, you get a trace report on the screen (see Figure 14.21). |
|
|
|
|
|
|
|
|
Figure 14.21.
Viewing the trace message. |
|
|
|
|
|
|
|
|
Notice that, in order to add module tracing to a project, you only need to add a .Push line at the start of the routine and a .Pop line at the end of the routine. This is all you need to do in order to update the procedure stack for the program. But, for this to be really valuable, you have to do this for each routine that you want to track. |
|
|
|
|
|